package cn.com.nes.site.controller.iot;

import cn.com.nes.common.web.CommonResult;
import cn.com.nes.site.controller.iot.vo.OverloadCacheVO;
import cn.com.nes.site.service.iot.V2ProtocolService;
import cn.com.nes.site.service.iot.bo.OverloadCacheBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 *
 * 设备协议接口层
 */
@Api(tags = {"热链物联 - 设备协议"})
@RestController
@RequestMapping("/v2/protocol")
public class ProtocolController {

    @Resource
    private V2ProtocolService v2ProtocolService;

    @ApiOperation("缓存重载")
    @RequestMapping(value = "/overloadCache", method = RequestMethod.POST)
    public CommonResult<?> overloadCache(@RequestBody @Validated OverloadCacheVO vo) throws Exception {
        return v2ProtocolService.overloadCache(vo.convertToBo(new OverloadCacheBO()));
    }

}
